# with open ('./test.txt', 'w', encoding = 'utf-8') as f:
#     f.write('2025-06-12 晴\n')
#     f.write('今天学习了Python的文件操作!\n')

# print('日记写入完成!')

# date = input('请输入今天的日期：')
# weather = input('请输入今天的天气：')
# mood = input('请输入今日心情或总结：')

# with open ('./test.txt', 'a', encoding = 'utf-8') as f1:
#     f1.write(date + ' ' + weather + '\n')
#     f1.write(mood + '\n\n')
# print('今日日记已追加!')

with open ('bill.txt', 'r+', encoding = 'utf-8') as f,open ('bill.txt.bak', 'w', encoding = 'utf-8') as f_bak:
    res = f.read()
    f_bak.read = res
    s = ''
    for i in res.split('\n'):
        if i.find ('测试') == -1:
            s += i + '\n'
    f.seek(0)
    f.truncate()
    f.write(s)
